package edu.zhuravlev.trainingbot.extractor;


import edu.zhuravlev.trainingbot.entity.User;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.objects.Update;


@Component
public class UserExtractor {

    public User extractUser(Update update) {
        org.telegram.telegrambots.meta.api.objects.User telegramUser = update.getMessage().getFrom();
        return new User(update.getMessage().getChatId(), telegramUser.getUserName());
    }

}
